 /*倒计时时钟*/
function foramtTelNum(str)
{       
    var content=""; 
 for(var i=0;i<str.length;i++)
    {
    
        content += "<img src='"+_public+"/sky/images/" + str.substring(i,i+1)+ ".png' />";
    }
    return content;
}
function findEnd(){
	var mydate=new Date();
	var endtime="";
//	if(mydate.getMonth()==6 && mydate.getDate()<=4&& mydate.getDate()>=1){
//		endtime="7/4/2012 23:59:59";
//	}else if(mydate.getMonth()==6 && mydate.getDate()<=11&& mydate.getDate()>=5)
//	{
//		endtime="7/11/2012 23:59:59";
//	}
//	if(mydate.getMonth()==6 && mydate.getDate()<=18&& mydate.getDate()>=12){
//		endtime="7/18/2012 23:59:59";
//	}else if(mydate.getMonth()==6 && mydate.getDate()<=25&& mydate.getDate()>=19){
//		endtime="7/25/2012 23:59:59";
//	}else {
//		endtime="";
//	}
	if(_isTimeShow>0){
		var m = mydate.getMonth()+1;
		var Mo=m.toString();
		var d = mydate.getDate().toString();
		endtime = Mo+'/'+d+'/'+'2012'+' 23:59:59';
	}
	return endtime;
}
function lxfEndtime(){
	$(".lxftime").each(function(){
		var endtime=findEnd();
		if(endtime==""){
			c1=foramtTelNum("--");
			c2=foramtTelNum("--");
			c3=foramtTelNum("--");
			c4=foramtTelNum("-");
		}else{
			var et=new Date(endtime);
            var endtime = new Date(endtime).getTime();//取结束日期(毫秒值)
			var myDate = new Date();
            var nowtime = new Date().getTime();        //今天的日期(毫秒值)
            var youtime = endtime-nowtime;//还有多久(毫秒值)
			var mseconds=youtime/100;
            var seconds =Math.floor(mseconds/10);
            var minutes = Math.floor(seconds/60);
            var hours = Math.floor(minutes/60);
            var days = Math.floor(hours/24);
            var CDay= days ;
            var CHour= hours % 24;
			var Ch=CHour.toString();
			if(Ch.length==1)
			{Ch="0"+Ch;}
			var c1=foramtTelNum(Ch);
            var CMinute= minutes % 60;
			var Cm=CMinute.toString();
			if(Cm.length==1)
			{Cm="0"+Cm;}
			var c2=foramtTelNum(Cm);
            var CSecond= seconds%60;//"%"是取余运算，可以理解为60进一后取余数，然后只要余数。
			var Cs=CSecond.toString();
			if(Cs.length==1)
			{Cs="0"+Cs;}
			var c3=foramtTelNum(Cs);
			var Cmseconds=Math.floor(mseconds%10);
		    var c4=foramtTelNum(Cmseconds.toString());
		}
		$(this).html("<span>"+c1+"</span>时<span>"+c2+"</span>分<span>"+c3+"</span>.<span>"+c4+"</span><em>秒</em>"); 
	});
	setTimeout("lxfEndtime()",100);
}
$(function(){
	lxfEndtime();
});